package cn.springcloud.fix.demo.leecode;

import java.util.HashMap;

public class Test10 {

    public static void main(String[] args) {
        test2();
    }

    static void test1() {
        System.out.println("-------------------");
        new A();
        System.out.println("-------------------");
        new A();
        System.out.println("-------------------");
    }

    static void test2() {
        System.out.println("-------------------");
        A.a();
        System.out.println("-------------------");
        A.a();
        System.out.println("-------------------");
    }

    static class B {
        {
            System.out.println("父类非静态代码块");
        }

        static {
            System.out.println("父类静态代码块");
        }

        public B() {
            System.out.println("父类构造器");
        }
    }

    static class A extends B {
        {
            System.out.println("子类非静态代码块");
        }

        static {
            System.out.println("子类静态代码块");
        }

        public A() {
            System.out.println("子类构造器");
        }

        public static void a() {
            System.out.println("执行方法a");
        }
    }
}
